<div id="filebrowser_container_<?php echo $this->getId()?>" <?php echo $this->getStyleHtml()?>>
<a id="filebrowser_<?php echo $this->getId()?>" href="javascript:void(0)">
<?php
if(strlen($this->getValue()) == 0):
echo Kd_Localize_Helper::__('share.button.select_image');
else:
?>
<ul class="file-selected">
<?php
$files = explode(',', $this->getValue());
foreach($files as $file):
?>
<li><img  class="file-selected-item" src="<?php echo $file ?>" width="80px" height="80px"/></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</a>
<div class="clear"></div>
</div>
<input type="hidden" id="<?php echo $this->getId()?>" name="<?php echo $this->getName() ?>" value="<?php echo $this->getValue() ?>"<?php echo $this->getValidateRuleHtml()?>/>
<script language="javascript" type="text/javascript">
function <?php echo $this->getCallback() ?>(files){
    if(files && files.length > 0){
        var html = '<ul class="file-selected">';
        var values = [];
        for(var i = 0; i < files.length; i++){
            values.push(files[i]);
            html += '<li><img class="file-selected-item" src="' + files[i] + '" width="80px" height="80px"/></li>';
        }
        html += '</ul>';
        $('#filebrowser_<?php echo $this->getId()?>').html(html);
        $('#<?php echo $this->getId()?>').val(values);
    }else{
        $('#filebrowser_<?php echo $this->getId()?>').html('<?php echo Kd_Localize_Helper::__('share.button.select_image') ?>');
        $('#<?php echo $this->getId()?>').val('');
    }
}
$('#filebrowser_<?php echo $this->getId()?>').click(function(){
    var setting = {
        'title':'<?php echo $this->getField()->getLabel()?>',
        'path':'<?php echo $this->getPath() ?>',
        'fileType':'<?php echo $this->getFileType() ?>',
        'callback':'<?php echo $this->getCallback() ?>'
    };
    var selectedFiles = [];
    $('#filebrowser_<?php echo $this->getId()?> .file-selected-item').each(function(){
        selectedFiles.push($(this).attr('src'));
    });
    setting.files = selectedFiles.join(',');
    showFileBrowser(setting);
})
</script>